﻿<%@ Page Title="POSSystem | Repair" Theme="POSSystem" Language="C#" MasterPageFile="~/Application.Master"
    AutoEventWireup="true" CodeBehind="Repair.aspx.cs" Inherits="WebUI.Repair" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<%@ Register Src="~/Controls/POSControls/RepairRequestListCtrl.ascx" TagName="RepairRequestList" TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <script type="text/javascript">
        function onShowModel() {
            var returnValue = window.showModalDialog('EditPages/EditRepairModel.aspx', '', 'dialogWidth=800px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowProblem() {
            var returnValue = window.showModalDialog('EditPages/ProblemList.aspx', '', 'dialogWidth=855px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowCurrentRepair() {
            var returnValue = window.showModalDialog('EditPages/ViewRepair.aspx', '', 'dialogWidth=900px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowCurrentRepairBox() {
            var returnValue = window.showModalDialog('EditPages/ViewRepairBoxes.aspx', '', 'dialogWidth=900px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowCallCustomer() {
            var returnValue = window.showModalDialog('EditPages/CallCustomer.aspx', '', 'dialogWidth=900px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowLookup() {
            var returnValue = window.showModalDialog('EditPages/RepairLookup.aspx', '', 'dialogWidth=800px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onShowHist() {
            var imei = document.getElementById("<%= txtIMEI.ClientID %>").value;
            var returnValue = window.showModalDialog('EditPages/RepairHist.aspx?imei=' + imei, '', 'dialogWidth=800px;dialogHeight=600px;resizable=no;help=no;unadorned=yes;');
            document.getElementById("<%= hidIMEI.ClientID %>").value = returnValue;
            if (returnValue > 0) {
                document.getElementById("<%= hidIMEI.ClientID %>").value = returnValue;
                return true;
            }
            else {
                document.getElementById("<%= hidIMEI.ClientID %>").value = '';
                return false;
            }
        }

        function showPrintDlg(key) {
            var returnValue = window.showModalDialog(key, '', 'dialogWidth=800px;dialogHeight=600px;resizable=yes;help=no;unadorned=yes;');
        }

        function addJob() {
            var btn = document.getElementById("<%= btnAddJob.ClientID %>").click();
        }

        function onEditSelectedProblem() {
            var lst = document.getElementById("<%= lstSelectedProblems.ClientID %>");
            if (lst.selectedIndex < 0)
                return false;
            var id = lst.options[lst.selectedIndex].value;
            var returnValue = window.showModalDialog('EditPages/EditSelectedProblem.aspx?id=' + id, '', 'dialogWidth=480px;dialogHeight=200px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }
    </script>
    <uc:PageHeader ID="pageHeader" Text="Repair System" ImageURL="~/Images/auto-repair_32.png"
        runat="server" />
    <table width="100%">
        <tr>
            <td style="text-align: left; vertical-align: top">
                <asp:Panel ID="panelProduct" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="Label4" runat="server" CssClass="titleContent">Repair Reception</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <asp:UpdatePanel ID="updateJob" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Panel ID="panelCustomer" runat="server" GroupingText="General Info">
                                    <table>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top; width: 150px">
                                                <asp:Label class='labelMessage' ID="Label5" runat="server" Text="Customer:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;" colspan="5">
                                                <asp:UpdatePanel ID="updateCust" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <cc1:ComboBox ID="ddlCustomer" runat="server" AutoCompleteMode="Suggest" CssClass="WindowsStyle"
                                                            DropDownStyle="Simple" AppendDataBoundItems="true" OnItemInserted="ddlCustomer_OnItemInserted"
                                                            AutoPostBack="true" OnSelectedIndexChanged="ddlCustomer_OnSelectedIndexChanged">
                                                        </cc1:ComboBox>
                                                        &nbsp;
                                                        <asp:Label ID="lblCustPrice" runat="server" Font-Size="16px" Font-Bold="true" CssClass="lblClass">RETAIL</asp:Label>
                                                        &nbsp;&nbsp;
                                                        <asp:Label class='labelMessage' ID="Label12" runat="server" Text="Phone:"></asp:Label>
                                                        <asp:TextBox ID="txtCustomerPhone" runat="server"></asp:TextBox>
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="Submit" ID="reqCustomerPhone"
                                                            runat="server" ControlToValidate="txtCustomerPhone" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                <asp:Label class='labelMessage' ID="Label14" runat="server" Text="Repair Box:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;" colspan="5">
                                                <asp:UpdatePanel ID="updateRepairBox" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:DropDownList ID="ddlRepairBox" runat="server" Width="465px" >
                                                            <asp:ListItem Text="--Select--" Value=""></asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="Submit" ID="RequiredFieldValidator4"
                                                            runat="server" ControlToValidate="ddlRepairBox" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                        <asp:Button ID="btnRefreshRepairBox" runat="server" ToolTip="Refresh Box Status" Text="Refresh" OnClick="btnRefreshRepairBox_Click" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                <asp:Label class='labelMessage' ID="Label17" runat="server" Text="Loan Phone:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;" colspan="5">
                                                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:TextBox ID="txtLoanIMEI" runat="server" OnTextChanged="txtLoanIMEI_OnTextChanged" AutoPostBack="true" ></asp:TextBox>
                                                        <cc1:TextBoxWatermarkExtender WatermarkText="Scan IMEI here" ID="TextBoxWatermarkExtender1" TargetControlID="txtLoanIMEI" runat="server" WatermarkCssClass="waterMark">
                                                        </cc1:TextBoxWatermarkExtender>
                                                        <asp:Label class='labelMessage' ID="txtLoanPhone" ReadOnly="true" runat="server"></asp:Label>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <asp:Panel ID="panelProblem" runat="server" GroupingText="Booking Phone" >
                                    <table>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                <asp:Label class='labelMessage' ID="Label2" runat="server" Text="Brand:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;">
                                                <asp:UpdatePanel ID="updateModel" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:DropDownList AutoPostBack="true" ID="ddlBrand" runat="server" OnSelectedIndexChanged="ddlBrand_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="AddProb" ID="RequiredFieldValidator1"
                                                            runat="server" ControlToValidate="ddlBrand" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                        &nbsp;&nbsp;
                                                        <asp:Label class='labelMessage' ID="Label3" runat="server" Text="Model:"></asp:Label>
                                                        <asp:DropDownList AutoPostBack="true" ID="ddlModel" runat="server" OnSelectedIndexChanged="ddlProblem_OnSelectedIndexChanged">
                                                            <asp:ListItem Text="--Select--" Value=""></asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="AddProb" ID="RequiredFieldValidator2"
                                                            runat="server" ControlToValidate="ddlModel" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                        &nbsp;&nbsp;
                                                        <asp:Label class='labelMessage' ID="Label6" runat="server" Text="IMEI:"></asp:Label>
                                                        <asp:TextBox ID="txtIMEI" runat="server"></asp:TextBox>
                                                        <asp:HiddenField ID="hidIMEI" runat="server" />
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="AddJob" ID="RequiredFieldValidator3"
                                                            runat="server" ControlToValidate="txtIMEI" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                         <asp:Button ID="btnShowHist" runat="server" OnClick="btnRedo_OnClick" OnClientClick="return onShowHist();" Text="Show History"></asp:Button>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                <asp:Label class='labelMessage' ID="Label7" runat="server" Text="Accessories:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;" colspan="5">
                                                <asp:Panel ID="panelAccessory" runat="server">
                                                    <asp:CheckBox ID="chkHousing" runat="server" Text="Housing" Checked="true" />
                                                    <asp:CheckBox ID="chkBackCover" runat="server" Text="Back Cover" Checked="true" />
                                                    <asp:CheckBox ID="chkBattery" runat="server" Text="Battery" Checked="true" />
                                                    <asp:CheckBox ID="chkCharge" runat="server" Text="Charge" />
                                                    <asp:CheckBox ID="chkMemoryCard" runat="server" Text="Memory Card" />
                                                </asp:Panel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top; width: 150px">
                                                <asp:Label class='labelMessage' ID="Label8" runat="server" Text="Problem:"></asp:Label>
                                            </td>
                                            <td style="text-align: left; vertical-align: top;">
                                                <asp:UpdatePanel ID="updateProblem" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:DropDownList AutoPostBack="true" ID="ddlProblem" runat="server" OnSelectedIndexChanged="ddlProblem_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="AddProb" ID="RequiredFieldValidator5"
                                                            runat="server" ControlToValidate="ddlModel" class="requiredField" Text="required"
                                                            ErrorMessage="required"></asp:RequiredFieldValidator>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                &nbsp;
                                            </td>
                                            <td style="text-align: left; vertical-align: top;">
                                                <asp:UpdatePanel ID="updatePrice" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:RadioButton Checked="true" GroupName="Price" class='labelMessage' ID="rbCustomer" runat="server"
                                                            Text="Customer: " />
                                                        <asp:TextBox Width="60px" ID="txtRPP" runat="server" ></asp:TextBox>
                                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" TargetControlID="txtRPP"
                                                            FilterType="Numbers,Custom" ValidChars="." runat="server">
                                                        </cc1:FilteredTextBoxExtender>
                                                        &nbsp;&nbsp;
                                                        <asp:RadioButton GroupName="Price" class='labelMessage' ID="rbDealer" runat="server"
                                                            Text="Dealer: " />
                                                        <asp:TextBox Width="60px" ID="txtDealer" runat="server"></asp:TextBox>
                                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" TargetControlID="txtDealer"
                                                            FilterType="Numbers,Custom" ValidChars="." runat="server">
                                                        </cc1:FilteredTextBoxExtender>
                                                        &nbsp;&nbsp;
                                                        <asp:RadioButton GroupName="Price" class='labelMessage' ID="rbSpecial" runat="server"
                                                            Text="Special: " />
                                                        <asp:TextBox Width="60px" ID="txtSpecial" runat="server"></asp:TextBox>
                                                         &nbsp;&nbsp;
                                                        <asp:Button ID="btnUpdatePrice" runat="server" OnClick="btnUpdatePrice_OnClick" Text="Update Price" />
                                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" TargetControlID="txtSpecial"
                                                            FilterType="Numbers,Custom" ValidChars="." runat="server">
                                                        </cc1:FilteredTextBoxExtender>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:UpdatePanel ID="UpdateAddProblem" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:Button ID="btnAddProblem"  ValidationGroup="AddProb" runat="server" Text="Add Problem" OnClick="btnAddProblem_OnClick" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top;">
                                                <asp:Label class='labelMessage' ID="Label9" runat="server" Text="Selected Problems:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:UpdatePanel ID="updateSelectedProblems" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <table class="toolbar" width="400px">
                                                            <tr>
                                                                <td>
                                                                    <asp:LinkButton class="tbbutton" ID="btnEdit" runat="server" ToolTip="Edit"
                                                                        OnClientClick="return onEditSelectedProblem();" OnClick="btnEdit_Click" >
                                                                        <img id="Img1" src="~/Images/Edit.gif" runat="server" style='vertical-align: middle' /><asp:Label ID="label18"
                                                                            class='labelMessage' runat="server" Text="Edit"></asp:Label>
                                                                    </asp:LinkButton>
                                                                    <asp:LinkButton class="tbbutton" ID="btnDelete" runat="server" ToolTip="Delete selected IMEI"
                                                                        OnClick="btnDelete_Click">
                                                                        <img src="~/Images/Delete.gif" runat="server" style='vertical-align: middle' /><asp:Label ID="label10"
                                                                            class='labelMessage' runat="server" Text="Delete"></asp:Label>
                                                                    </asp:LinkButton>
                                                                    <asp:LinkButton class="tbbutton" ID="btnClear" runat="server" ToolTip="Clear all"
                                                                        OnClick="btnClear_Click">
                                                                        <img src="~/Images/edit-clear.png" runat="server" style='vertical-align: middle' /><asp:Label
                                                                            ID="label11" class='labelMessage' runat="server" Text="Clear"></asp:Label>
                                                                    </asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        <asp:ListBox Width="400px" Height="100px" ID="lstSelectedProblems" runat="server"
                                                             ></asp:ListBox>
                                                        <div style="Width:400px; text-align:right">
                                                            <asp:Label ID="label13" class='labelMessage0' runat="server" Text="Total: "></asp:Label>
                                                            <asp:Label ID="lblTotal" class='labelMessage0' runat="server" Text="$0.00"></asp:Label>
                                                        </div>
                                                        <asp:Button ID="button1" runat="server" Text="Add To Booking List" OnClientClick="addJob(); return false;" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <asp:Panel ID="panel2" runat="server" GroupingText="Booking List" >
                                    <table>
                                        <tr>
                                            <td style="text-align: right; vertical-align: top; width: 150px">
                                                
                                            </td>
                                            <td style="text-align: left; vertical-align: top;">
                                                <asp:UpdatePanel ID="updateRequestList" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                         <table class="toolbar" Width="600px">
                                                            <tr>
                                                                <td>
                                                                    <asp:LinkButton class="tbbutton" ID="LinkButton1" runat="server" ToolTip="Delete selected job"
                                                                        OnClick="btnDeleteJob_Click">
                                                                        <img src="~/Images/Delete.gif" runat="server" style='vertical-align: middle' /><asp:Label ID="label15"
                                                                            class='labelMessage' runat="server" Text="Delete"></asp:Label>
                                                                    </asp:LinkButton>
                                                                    <asp:LinkButton class="tbbutton" ID="LinkButton2" runat="server" ToolTip="Clear all booking job"
                                                                        OnClick="btnClearJob_Click">
                                                                        <img src="~/Images/edit-clear.png" runat="server" style='vertical-align: middle' /><asp:Label
                                                                            ID="label16" class='labelMessage' runat="server" Text="Clear"></asp:Label>
                                                                    </asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                         <uc:RepairRequestList ID="gridRequests" runat="server" AllowPaging="false" AllowSelecting="true" AllowSorting="false" 
                                                            ShowFooter="false" Width="600px" />
                                                        <asp:Button ID="btnAddJob" ValidationGroup="AddJob" runat="server" Text="Add To Booking List" OnClick="btnAddJob_OnClick" style="display:none" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <div style="height: 5px" runat="server">
                                </div>
                                <div style="float:right" >
                                    <asp:CheckBox ID="chkPrint" runat="server" Text="Auto print after Submit" Checked="true" />
                                </div>
                                <div id="Div1" style="text-align: center" runat="server">
                                    <asp:Button ID="btnNewJob" runat="server" Text="Clear Form" OnClick="btnNew_OnClick"  />
                                    <asp:Button ID="btnSubmit" ValidationGroup="Submit" runat="server" Text="Submit" OnClick="btnSubmit_OnClick" />
                                    <asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_OnClick" Visible="false" />
                                </div>

                                <asp:UpdatePanel ID="updateError" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:Panel ID="panelError" runat="server">
                                        </asp:Panel>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </asp:Panel>
            </td>
            <td style="text-align: left; vertical-align: top; width: 200px">
                <asp:Panel ID="panel1" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="Label1" runat="server" CssClass="titleContent">Repair Management</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder" style="text-align: center">
                        <asp:Button ID="btnRepairByBox" runat="server" Text="Repair Status by Box" Width="100%" OnClientClick="onShowCurrentRepairBox(); return false;" />
                        <div style="height: 4px">
                            &nbsp;
                        </div>
                        <asp:Button ID="btnCurrentRepair" runat="server" Text="Repair Status by Customer" Width="100%" OnClientClick="onShowCurrentRepair(); return false;" />
                        <div style="height: 4px">
                            &nbsp;
                        </div>
                        <asp:Button ID="btnCallCustomer" runat="server" Text="Call Customer" Width="100%" OnClientClick="onShowCallCustomer(); return false;" />
                        <div style="height: 4px">
                            &nbsp;
                        </div>
                        <asp:Button ID="btnLookup" runat="server" Text="Repair Lookup" Width="100%" OnClientClick="onShowLookup(); return false;" />
                        <div style="height: 40px">
                            &nbsp;
                        </div>

                        <asp:Button ID="btnQuotation" runat="server" Text="Model List" Width="100%" OnClientClick="onShowModel(); return false;" />
                        <div style="height: 4px">
                            &nbsp;
                        </div>
                        <asp:Button ID="btnProblem" runat="server" Text="Problem List" Width="100%" OnClientClick="onShowProblem(); return false;" />
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
